package com.tc.shiro.service.impl;

import com.tc.shiro.entity.PortalOperator;
import com.tc.shiro.model.OperatorInfo;
import com.tc.shiro.repository.PortalOperatorRepository;
import com.tc.shiro.service.OperatorService;
import com.tc.support.BeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OperatorServiceImpl implements OperatorService {

    @Autowired
    private PortalOperatorRepository portalOperatorRepo;

    @Autowired
    private BeanMapper beanMapper;

    @Override
    public OperatorInfo queryOperaterInfo(String loginName, Object o) {
        PortalOperator operatorSelect = new PortalOperator();
        operatorSelect.setOperator(loginName);
        operatorSelect.setMercNo((String)o);
        PortalOperator portalOperator = portalOperatorRepo.selectByOperator(operatorSelect);
        return beanMapper.map(portalOperator,OperatorInfo.class);
    }
}
